import 'package:flutter/widgets.dart';

///提示的文字信息
class HintTextWidget extends StatelessWidget {
  const HintTextWidget({
    Key? key,
    this.isEmpty,
    this.hintText,
    this.hintStyle,
    this.hintMaxLines = 1,
    this.child,
  }) : super(key: key);
  final bool? isEmpty;
  final String? hintText;
  final TextStyle? hintStyle;
  final int? hintMaxLines;
  final Widget? child;
  @override
  Widget build(BuildContext context) {
    return Stack(
      alignment: AlignmentDirectional.centerStart,
      children: [
        AnimatedOpacity(
          opacity: isEmpty! ? 1.0 : 0.0,
          duration: Duration(milliseconds: 200),
          curve: Curves.fastOutSlowIn,
          alwaysIncludeSemantics: true,
          child: Text(
            hintText!,
            style: hintStyle!.copyWith(decoration: TextDecoration.none),
            overflow: TextOverflow.ellipsis,
            maxLines: hintMaxLines,
          ),
        ),
        child!,
      ],
    );
  }
}
